log using Heaney_MFRJ_Code2022-04-14.log

* Michael T. Heaney
* March for Racial Justice (MFRJ), 2017
* April 14, 2022

* Generate Survey Weights for 2017

generate weight = 1.0

* Weights for Event 12: March for Racial Justice, Washington, DC, 2017

replace weight  = 0.949587294 if EventNumber==12&Year==2017&sex==0&rwhite==.
replace weight  = 0.940169437 if EventNumber==12&Year==2017&sex==1&rwhite==.
replace weight  = 1.129852744 if EventNumber==12&Year==2017&sex==.&rnative==1
replace weight  = 0.996928892 if EventNumber==12&Year==2017&sex==.&rwhite==1
replace weight  = 1.129852744 if EventNumber==12&Year==2017&sex==.&rblack==1
replace weight  = 1.016867470 if EventNumber==12&Year==2017&sex==.&rasian==1
replace weight  = 0.932128514 if EventNumber==12&Year==2017&sex==.&rlatino==1
replace weight  = 0.847389558 if EventNumber==12&Year==2017&sex==.&rother==1
replace weight  = 1.694779116 if EventNumber==12&Year==2017&rnative==1&sex==0
replace weight  = 1.151580682 if EventNumber==12&Year==2017&rwhite==1&sex==0
replace weight  = 1.210556512 if EventNumber==12&Year==2017&rblack==1&sex==0
replace weight  = 1.186345382 if EventNumber==12&Year==2017&rasian==1&sex==0
replace weight  = 1.694779116 if EventNumber==12&Year==2017&rlatino==1&sex==0
replace weight  = 0.847389558 if EventNumber==12&Year==2017&rother==1&sex==0
replace weight  = 0.847389558 if EventNumber==12&Year==2017&rnative==1&sex==1
replace weight  = 0.934749307 if EventNumber==12&Year==2017&rwhite==1&sex==1
replace weight  = 1.070386810 if EventNumber==12&Year==2017&rblack==1&sex==1
replace weight  = 0.847389558 if EventNumber==12&Year==2017&rasian==1&sex==1
replace weight  = 0.847389558 if EventNumber==12&Year==2017&rlatino==1&sex==1
replace weight  = 0.847389558 if EventNumber==12&Year==2017&rother==1&sex==1

* Weights for Event 13: March for Racial Justice, New York, NY, 2017

replace weight  = 1.076998051 if EventNumber==12&Year==2017&sex==0&rwhite==.
replace weight  = 1.000905797 if EventNumber==12&Year==2017&sex==1&rwhite==.
replace weight  = 0.787037037 if EventNumber==12&Year==2017&sex==.&rnative==1
replace weight  = 0.987248213 if EventNumber==12&Year==2017&sex==.&rwhite==1
replace weight  = 1.731481481 if EventNumber==12&Year==2017&sex==.&rblack==1
replace weight  = 1.001683502 if EventNumber==12&Year==2017&sex==.&rasian==1
replace weight  = 1.001683502 if EventNumber==12&Year==2017&sex==.&rlatino==1
replace weight  = 0.899470899 if EventNumber==12&Year==2017&sex==.&rother==1
replace weight  = 0.787037037 if EventNumber==12&Year==2017&rnative==1&sex==0
replace weight  = 1.093106996 if EventNumber==12&Year==2017&rwhite==1&sex==0
replace weight  = 1.180555556 if EventNumber==12&Year==2017&rblack==1&sex==0
replace weight  = 0.787037037 if EventNumber==12&Year==2017&rasian==1&sex==0
replace weight  = 1.180555556 if EventNumber==12&Year==2017&rlatino==1&sex==0
replace weight  = 0.899470899 if EventNumber==12&Year==2017&rother==1&sex==0
replace weight  = 0.787037037 if EventNumber==12&Year==2017&rnative==1&sex==1
replace weight  = 0.946571572 if EventNumber==12&Year==2017&rwhite==1&sex==1
replace weight  = 1.311728395 if EventNumber==12&Year==2017&rblack==1&sex==1
replace weight  = 1.259259259 if EventNumber==12&Year==2017&rasian==1&sex==1
replace weight  = 0.944444444 if EventNumber==12&Year==2017&rlatino==1&sex==1
replace weight  = 0.899470899 if EventNumber==12&Year==2017&rother==1&sex==1

* Weights for Event 14: March for Racial Justice, Providence, RI, 2017

replace weight  = 1.152027027 if EventNumber==12&Year==2017&sex==0&rwhite==.
replace weight  = 0.955598456 if EventNumber==12&Year==2017&sex==1&rwhite==.
replace weight  = 0.743243243 if EventNumber==12&Year==2017&sex==.&rnative==1
replace weight  = 0.914760915 if EventNumber==12&Year==2017&sex==.&rwhite==1
replace weight  = 1.911196911 if EventNumber==12&Year==2017&sex==.&rblack==1
replace weight  = 1.486486486 if EventNumber==12&Year==2017&sex==.&rasian==1
replace weight  = 0.743243243 if EventNumber==12&Year==2017&sex==.&rlatino==1
replace weight  = 0.743243243 if EventNumber==12&Year==2017&sex==.&rother==1
replace weight  = 0.743243243 if EventNumber==12&Year==2017&rnative==1&sex==0
replace weight  = 1.005564388 if EventNumber==12&Year==2017&rwhite==1&sex==0
replace weight  = 2.229729730 if EventNumber==12&Year==2017&rblack==1&sex==0
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rasian==1&sex==0
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rlatino==1&sex==0
replace weight  = 0.743243243 if EventNumber==12&Year==2017&rother==1&sex==0
replace weight  = 0.743243243 if EventNumber==12&Year==2017&rnative==1&sex==1
replace weight  = 0.849420849 if EventNumber==12&Year==2017&rwhite==1&sex==1
replace weight  = 1.486486486 if EventNumber==12&Year==2017&rblack==1&sex==1
replace weight  = 0.743243243 if EventNumber==12&Year==2017&rasian==1&sex==1
replace weight  = 0.743243243 if EventNumber==12&Year==2017&rlatino==1&sex==1
replace weight  = 0.743243243 if EventNumber==12&Year==2017&rother==1&sex==1

* Weights for Event 15: March for Racial Justice, Tallahassee, FL, 2017

replace weight  = 1.000000000 if EventNumber==12&Year==2017&sex==0&rwhite==.
replace weight  = 1.000000000 if EventNumber==12&Year==2017&sex==1&rwhite==.
replace weight  = 1.000000000 if EventNumber==12&Year==2017&sex==.&rnative==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&sex==.&rwhite==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&sex==.&rblack==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&sex==.&rasian==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&sex==.&rlatino==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&sex==.&rother==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rnative==1&sex==0
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rwhite==1&sex==0
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rblack==1&sex==0
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rasian==1&sex==0
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rlatino==1&sex==0
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rother==1&sex==0
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rnative==1&sex==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rwhite==1&sex==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rblack==1&sex==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rasian==1&sex==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rlatino==1&sex==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rother==1&sex==1

* Weights for Event 16: March for Racial Justice, Los Angeles, CA, 2017

replace weight  = 1.102040816 if EventNumber==12&Year==2017&sex==0&rwhite==.
replace weight  = 0.983193277 if EventNumber==12&Year==2017&sex==1&rwhite==.
replace weight  = 0.857142857 if EventNumber==12&Year==2017&sex==.&rnative==1
replace weight  = 1.054945055 if EventNumber==12&Year==2017&sex==.&rwhite==1
replace weight  = 1.186813187 if EventNumber==12&Year==2017&sex==.&rblack==1
replace weight  = 0.857142857 if EventNumber==12&Year==2017&sex==.&rasian==1
replace weight  = 0.857142857 if EventNumber==12&Year==2017&sex==.&rlatino==1
replace weight  = 0.857142857 if EventNumber==12&Year==2017&sex==.&rother==1
replace weight  = 0.857142857 if EventNumber==12&Year==2017&rnative==1&sex==0
replace weight  = 1.178571429 if EventNumber==12&Year==2017&rwhite==1&sex==0
replace weight  = 1.142857143 if EventNumber==12&Year==2017&rblack==1&sex==0
replace weight  = 0.857142857 if EventNumber==12&Year==2017&rasian==1&sex==0
replace weight  = 0.857142857 if EventNumber==12&Year==2017&rlatino==1&sex==0
replace weight  = 0.857142857 if EventNumber==12&Year==2017&rother==1&sex==0
replace weight  = 0.857142857 if EventNumber==12&Year==2017&rnative==1&sex==1
replace weight  = 1.000000000 if EventNumber==12&Year==2017&rwhite==1&sex==1
replace weight  = 1.028571429 if EventNumber==12&Year==2017&rblack==1&sex==1
replace weight  = 0.857142857 if EventNumber==12&Year==2017&rasian==1&sex==1
replace weight  = 0.857142857 if EventNumber==12&Year==2017&rlatino==1&sex==1
replace weight  = 0.857142857 if EventNumber==12&Year==2017&rother==1&sex==1


* Event Dummy Variables

generate Event12 = 1 if EventNumber == 12&Year==2017 
replace Event12 = 0 if EventNumber != 12|Year==2018

* Recode Variables

generate female = 1 if sex == 1
replace female = 0 if sex == 0
replace female = 0 if sex == 2

recode inc (0=0) (1=7.5) (2=20) (3=37.5) (4=62.5) (5=87.5) (6=112.5) (7=137.5) (8=250) (9=450), gen(income)

generate logdistance = log(distance) if distance >= 1
replace logdistance = 0 if distance < 1

recode ideo (9=1) (8=2) (7=3) (6=4) (5=5) (4=6) (3=7) (2=8) (1=9) (10=.), gen(r_ideo)

recode pid (1=3) (2=2) (3=1) (4=0) (5=1) (6=2) (7=3) (8=.), gen(pid_folded)

recode aidimp (1=4) (2=3) (3=2) (4=1) (5=.), gen(r_aidimp)

recode know (1=3) (2=2) (3=1), gen(r_know)

recode demworks (1=4) (2=3) (3=2) (4=1), gen(r_demworks)

recode ang (1=5) (2=4) (3=3) (4=2) (5=1), gen(r_ang)

* Set Survey Weights

svyset [pweight=weight], strata(EventNumber)

* Sample Sizes 

sum CaseID blm if EventNumber == 12
sum CaseID blm if EventNumber == 13
sum CaseID blm if EventNumber == 14
sum CaseID blm if EventNumber == 15
sum CaseID blm if EventNumber == 16

*** Main Analysis

* Impute missing values

impute blm rblack rlatino rasian rother female age_numeric educ income logdistance r_ideo pid_folded member r_aidimp r_know, gen(j_blm)
replace j_blm = 0 if j_blm < 0 
replace j_blm = 1 if j_blm > 1 
impute rblack blm rlatino rasian rother female age_numeric educ income logdistance r_ideo pid_folded member r_aidimp r_know, gen(j_rblack)
replace j_rblack = 0 if j_rblack < 0
replace j_rblack = 1 if j_rblack > 1
impute rlatino blm rblack rasian rother female age_numeric educ income logdistance r_ideo pid_folded member r_aidimp r_know, gen(j_rlatino)
replace j_rlatino = 0 if j_rlatino < 0
replace j_rlatino = 1 if j_rlatino > 1
impute rasian blm rblack rlatino rother female age_numeric educ income logdistance r_ideo pid_folded member r_aidimp r_know, gen(j_rasian)
replace j_rasian = 0 if j_rasian < 0
replace j_rasian = 1 if j_rasian > 1
impute rother blm rblack rlatino rasian female age_numeric educ income logdistance r_ideo pid_folded member r_aidimp r_know, gen(j_rother)
replace j_rother = 0 if j_rother < 0
replace j_rother = 1 if j_rother > 1
impute female blm rblack rlatino rasian rother age_numeric educ income logdistance r_ideo pid_folded member r_aidimp r_know, gen(j_female)
replace j_female = 0 if j_female < 0
replace j_female = 1 if j_female > 1
impute age_numeric blm rblack rlatino rasian rother female educ income logdistance r_ideo pid_folded member r_aidimp r_know, gen(j_age_numeric)
replace j_age_numeric = 0 if j_age_numeric < 0 
impute educ rblack blm rlatino rasian rother female age_numeric income logdistance r_ideo pid_folded member r_aidimp r_know, gen(j_educ)
replace j_educ = 1 if j_educ < 1 
replace j_educ = 6 if j_educ > 6 
impute income rblack blm rlatino rasian rother female age_numeric educ logdistance r_ideo pid_folded member r_aidimp r_know, gen(j_income)
replace j_income = 0 if j_income < 0
impute logdistance blm rblack rlatino rasian rother female age_numeric educ income r_ideo pid_folded member r_aidimp r_know, gen(j_logdistance)
replace j_logdistance = 0 if j_logdistance < 0
impute r_ideo rblack blm rlatino rasian rother female age_numeric educ income logdistance pid_folded member r_aidimp r_know, gen(j_r_ideo)
replace j_r_ideo = 1 if j_r_ideo < 1
replace j_r_ideo = 9 if j_r_ideo > 9
impute pid_folded blm rblack rlatino rasian rother female age_numeric educ income logdistance r_ideo member r_aidimp r_know, gen(j_pid_folded)
replace j_pid_folded = 0 if j_pid_folded < 0 
replace j_pid_folded = 3 if j_pid_folded > 3 
impute member blm rblack rlatino rasian rother female age_numeric educ income logdistance r_ideo pid_folded r_aidimp r_know, gen(j_member)
replace j_member = 1 if j_member > 1 
replace j_member = 0 if j_member < 0 
impute r_aidimp blm rblack rlatino rasian rother female age_numeric educ income logdistance r_ideo pid_folded member r_know, gen(j_r_aidimp)
replace j_r_aidimp = 1 if j_r_aidimp < 1 
replace j_r_aidimp = 4 if j_r_aidimp > 4 
impute r_know blm rblack rlatino rasian rother female age_numeric educ income logdistance r_ideo pid_folded member r_aidimp, gen(j_r_know)
replace j_r_know = 1 if j_r_know < 1 
replace j_r_know = 3 if j_r_know > 3 

* Table 4, Model 1: Comparing activists at MFRJ in DC versus those not in DC who attended MFRJ events

svy: mean socialmedia
svy: mean r_demworks
svy: mean violencejust
svy: mean r_ang

sum socialmedia r_demworks violencejust r_ang

svy: oprobit socialmedia Washington_DC j_rblack j_rlatin j_rasian j_rother j_female j_age_numeric j_educ j_income j_logdistance /*
	*/ j_r_ideo j_pid_folded j_member j_r_aidimp j_r_know
	
svy: oprobit r_demworks Washington_DC j_rblack j_rlatino j_rasian j_rother j_female j_age_numeric j_educ j_income j_logdistance /*
	*/ j_r_ideo j_pid_folded j_member j_r_aidimp j_r_know 
	
svy: oprobit violencejust Washington_DC j_rblack j_rlatino j_rasian j_rother j_female j_age_numeric j_educ j_income j_logdistance /*
	*/ j_r_ideo j_pid_folded j_member j_r_aidimp j_r_know
	
svy: oprobit r_ang Washington_DC j_rblack j_rlatino j_rasian j_rother j_female j_age_numeric j_educ j_income j_logdistance /*
	*/ j_r_ideo j_pid_folded j_member j_r_aidimp j_r_know

log close

